//
//  CHControlAdditions.m
//  Chocolat
//
//  Created by Pieter Omvlee on 8/6/08.
//  Copyright 2008 Insearchofaname. All rights reserved.
//

#import "CHControlAdditions.h"


@implementation NSControl (NSControlSizing)

- (void)sizeToFitHeight
{
  NSRect oldFrame = [self frame];
  [self sizeToFit];
  NSRect r = [self frame];
  r.size.height = MAX(r.size.height,(r.size.width / oldFrame.size.width) * r.size.height);
  r.size.width = oldFrame.size.width;
//  r.origin.y = NSMaxY(oldFrame) - r.size.height;
  
  
  [self setFrame:r];  
}

@end
